import Api from '@/api/tool'
import ModelApi from '@/views/modelCenter/api'

// 列表表头
export const listFormLabel = [
    { label: '模型名称', prop: 'modelName' },
    { label: '模型ID', prop: 'id', required: false },
    {
        label: '专业类型', prop: 'professionalType', type: 'cascader', options: Api.getDictItems({ page: 1, limit: 1000, dictCode: 'professional_type', queryMode: 0 }).then(res => {
            return res.records.map((item) => {
                return {
                    label: item['name'],
                    value: item['value']
                }
            })
        }).catch((e) => {
            return [{ label: '道路', value: '道路' }, { label: '桥涵', value: '桥涵' }, { label: '施工2', value: '施工' }]
        })
    },
    { label: '所属版本', prop: 'modelVersion', required: false },
    {
        label: '是否关联项目', prop: 'isAssociateProject', type: 'cascader', options: [{ label: '是', value: 1 }, { label: '否', value: 0 }], changeFunc(val) {
            this.$set(this.formLabel[this.formLabelMap['projectName']], 'hide', val === 0)
            this.$set(this.formLabel[this.formLabelMap['projectName']], 'required', val === 1)
        }
    },
    {
        label: '项目名称', prop: 'projectName', type: 'cascader', options: ModelApi.getBimProjectList({ page: 1, limit: 100000000 }).then(res => {
            return res.records.map((item) => {
                return {
                    label: item['projectName'],
                    value: item['id']
                }
            })
        }).catch((e) => {
            return [{ label: '道路', value: '道路' }, { label: '桥涵', value: '桥涵' }, { label: '施工2', value: '施工' }]
        })
    },
    { label: '模型描述', prop: 'modelDescription', required: false },
    { label: '选择模型', prop: 'modelFileSelect', type: 'upload' },
    { label: '创建人', prop: 'creater' },
    { label: '联系电话', prop: 'directorTelephone' },
    { label: '预览设置', prop: 'previewType', type: 'cascader', options: [{ label: '所有人可浏览', value: '0' }, { label: '仅限部门浏览', value: '1' }] },
    { label: '分享设置', prop: 'shareType', type: 'cascader', options: [{ label: '所有人可分享', value: '0' }, { label: '仅限部门分享', value: '1' }] },
    { label: '下载设置', prop: 'downloadType', type: 'cascader', options: [{ label: '项目可下载', value: '0' }, { label: '项目下载需要审批', value: '1' }] }
]
